import request from '@/utils/request'

// 获取model信息
export function findModelPage(params) {
    return request({
        url: '/workflow/model/findPage',
        method: 'GET',
        params
    })
}

// 流程部署
export function deploy(id) {
    return request({
        url: `/workflow/model/deploy/${id}`,
        method: 'POST'
    })
}
// 流程删除
export function delModel(id) {
    return request({
        url: `/workflow/model/delete/${id}`,
        method: 'POST'
    })
}

// 创建model
export function createModel(data) {
    return request({
        url: '/workflow/model/createModel',
        method: 'POST',
        data
    })
}

// 发起流程
export function startByKey(data) {
    return request({
        url: '/workflow/instance/startByKey',
        method: 'POST',
        data
    })
}
// 获取流程信息
export function findInstancePage(params) {
    return request({
        url: '/workflow/instance/findPage',
        method: 'GET',
        params
    })
}
// 流程部署
export function editInstanceState(data) {
    return request({
        url: '/workflow/instance/editState',
        method: 'POST',
        data
    })
}
// 流程删除
export function delInstance(id) {
    return request({
        url: `/workflow/instance/delete/${id}`,
        method: 'POST',
    })
}

// 获取申请信息
export function findApplyPage(params) {
    return request({
        url: '/workflow/task/apply',
        method: 'GET',
        params
    })
}

// 获取代办信息
export function findBacklogPage(params) {
    return request({
        url: '/workflow/task/backlog',
        method: 'GET',
        params
    })
}

// 获取已办信息
export function findFinishedPage(params) {
    return request({
        url: '/workflow/task/finished',
        method: 'GET',
        params
    })
}

// 获取审批历史信息
export function findRecordsPage(params) {
    return request({
        url: '/workflow/task/records',
        method: 'GET',
        params
    })
}

// 办理
export function executeTask(data) {
    return request({
        url: '/workflow/task/executeTask',
        method: 'POST',
        data
    })
}

// 添加评论
export function addComment(data) {
    return request({
        url: '/workflow/task/comment',
        method: 'POST',
        data
    })
}

